﻿
class DataAccess
{
	private var _dataFile:XML;
	public static var da:Object; 
	private static var _images:Array = new Array();
	
	
	public function DataAccess()
	{
		DataAccess.da = this;
	}
	
	public function getImages():Array
	{
		return DataAccess._images.concat();
	}
	
	
	
	public function sendNodes(file, searchName, callBack):Void
	{
		for(var i = 0; i< file.childNodes.length;i++)
		{
			var currentNode = file.childNodes[i];
			
			if(currentNode.nodeName == searchName)
			{
				callBack(currentNode);
			}
			if(currentNode.childNodes.length > 0)
			{
				sendNodes(currentNode, searchName, callBack);
			}
		}
	}
	
	public function handleImages(cnode):Void
	{
		var tempObj:Object = new Object();
		
		tempObj.id = cnode.attributes['id'];
		tempObj.path = cnode.attributes['path'];
		tempObj.thumb = cnode.attributes['thumb'];
		tempObj.visibile = cnode.attributes['visibile'];
		
		
		DataAccess._images.push(tempObj);
	}
} 







